diff -ru ntfsprogs-1.8.0/configure.ac ntfsprogs-1.8.0.patch/configure.ac
--- ntfsprogs-1.8.0/configure.ac	Wed Nov 19 11:31:26 2003
+++ ntfsprogs-1.8.0.patch/configure.ac	Sun Jan  4 20:56:14 2004
@@ -168,7 +168,8 @@
 AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \
 	stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \
 	sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h getopt.h sys/stat.h \
-	sys/types.h asm/byteorder.h linux/major.h linux/fd.h])
+	sys/types.h asm/byteorder.h linux/major.h linux/fd.h \
+	endian.h byteswap.h sys/param.h sys/endian.h features.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_HEADER_STDBOOL
@@ -192,7 +193,7 @@
 AC_FUNC_UTIME_NULL
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \
-	strcasecmp strchr strdup strerror strtol strtoul utime])
+	strcasecmp strchr strdup strerror strtol strtoul utime mbsinit])
 
 # Makefiles to be created by configure.
 AC_CONFIG_FILES([
diff -ru ntfsprogs-1.8.0/include/endians.h ntfsprogs-1.8.0.patch/include/endians.h
--- ntfsprogs-1.8.0/include/endians.h	Wed Nov 19 11:03:31 2003
+++ ntfsprogs-1.8.0.patch/include/endians.h	Sun Jan  4 21:04:53 2004
@@ -32,9 +32,20 @@
  * turns out that we do need to use the unaligned access macros on
  * architectures requiring aligned memory accesses...
  */
-
-#include <endian.h>
-#include <byteswap.h>
+#ifdef HAVE_ENDIAN_H
+#	include <endian.h>
+#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#	include <sys/endian.h>
+#ifndef __BYTE_ORDER
+#define __BYTE_ORDER _BYTE_ORDER
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
+#define __BIG_ENDIAN _BIG_ENDIAN
+#endif
+#endif
+#ifdef HAVE_BYTESWAP_H
+#	include <byteswap.h>
+#endif
 
 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
 
diff -ru ntfsprogs-1.8.0/include/volume.h ntfsprogs-1.8.0.patch/include/volume.h
--- ntfsprogs-1.8.0/include/volume.h	Tue Nov  4 13:29:55 2003
+++ ntfsprogs-1.8.0.patch/include/volume.h	Sun Jan  4 20:40:42 2004
@@ -25,13 +25,18 @@
 #include "config.h"
 
 #include <stdio.h>
-#include <sys/mount.h>
+#ifdef HAVE_SYS_PARAM_H
+#	include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#	include <sys/mount.h>
+#endif
 #ifdef HAVE_MNTENT_H
 #	include <mntent.h>
 #endif
 
 /* Cygwin doesn't seem to have MS_RDONLY, so we define it here. */
-#if defined(__CYGWIN32__) && !defined(MS_RDONLY)
+#if !defined(MS_RDONLY)
 typedef enum {
 	MS_RDONLY = 1,
 } MS_MOUNT;
diff -ru ntfsprogs-1.8.0/libntfs/unistr.c ntfsprogs-1.8.0.patch/libntfs/unistr.c
--- ntfsprogs-1.8.0/libntfs/unistr.c	Tue Nov  4 13:29:55 2003
+++ ntfsprogs-1.8.0.patch/libntfs/unistr.c	Sun Jan  4 21:21:07 2004
@@ -321,8 +321,9 @@
 	wchar_t wc;
 	int i, o, mbs_len;
 	int cnt = 0;
+#ifdef HAVE_MBSINIT
 	mbstate_t mbstate;
-
+#endif
 	if (!ins || !outs) {
 		errno = EINVAL;
 		return -1;
@@ -339,7 +340,11 @@
 		if (!mbs)
 			return -1;
 	}
+#ifdef HAVE_MBSINIT
 	memset(&mbstate, 0, sizeof(mbstate));
+#else
+	wctomb(NULL, 0);
+#endif
 	for (i = o = 0; i < ins_len; i++) {
 		/* Reallocate memory if necessary or abort. */
 		if ((int)(o + MB_CUR_MAX) > mbs_len) {
@@ -361,7 +366,11 @@
 		if (!wc)
 			break;
 		/* Convert the CPU endian wide character to multibyte. */
+#ifdef HAVE_MBSINIT
 		cnt = wcrtomb(mbs + o, wc, &mbstate);
+#else
+		cnt = wctomb(mbs + o, wc);
+#endif
 		if (cnt == -1)
 			goto err_out;
 		if (cnt <= 0) {
@@ -372,11 +381,13 @@
 		o += cnt;
 	}
 	/* Make sure we are back in the initial state. */
+#ifdef HAVE_MBSINIT
 	if (!mbsinit(&mbstate)) {
 		Dputs("Eeek. mbstate not in initial state!");
 		errno = EILSEQ;
 		goto err_out;
 	}
+#endif
 	/* Now write the NULL character. */
 	mbs[o] = '\0';
 	if (*outs != mbs)
@@ -421,8 +432,9 @@
 	char *s;
 	wchar_t wc;
 	int i, o, cnt, ins_len, ucs_len;
+#ifdef HAVE_MBSINIT
 	mbstate_t mbstate;
-
+#endif
 	if (!ins || !outs) {
 		errno = EINVAL;
 		return -1;
@@ -435,11 +447,20 @@
 	}
 	/* Determine the length of the multi-byte string. */
 	s = ins;
+#ifdef HAVE_MBSINIT
 	memset(&mbstate, 0, sizeof(mbstate));
 	ins_len = mbsrtowcs(NULL, (const char **)&s, 0, &mbstate);
+#else
+	ins_len = mbstowcs(NULL, s, 0);
+#endif
 	if (ins_len == -1)
 		return ins_len;
-	if ((s != ins) || !mbsinit(&mbstate)) {
+#ifdef HAVE_MBSINIT
+	if ((s != ins) || !mbsinit(&mbstate))
+#else
+	if (s != ins)
+#endif
+	{
 		errno = EILSEQ;
 		return -1;
 	}
@@ -451,7 +472,11 @@
 		if (!ucs)
 			return -1;
 	}
+#ifdef HAVE_MBSINIT
 	memset(&mbstate, 0, sizeof(mbstate));
+#else
+	mbtowc(NULL, NULL,0);
+#endif
 	for (i = o = cnt = 0; o < ins_len; i += cnt, o++) {
 		/* Reallocate memory if necessary or abort. */
 		if (o >= ucs_len) {
@@ -472,7 +497,11 @@
 			ucs_len /= sizeof(uchar_t);
 		}
 		/* Convert the multibyte character to a wide character. */
+#ifdef HAVE_MBSINIT
 		cnt = mbrtowc(&wc, ins + i, ins_len - i, &mbstate);
+#else
+		cnt = mbtowc(&wc, ins + i, ins_len - i);
+#endif
 		if (!cnt)
 			break;
 		if (cnt == -1)
@@ -491,6 +520,7 @@
 		/* Convert the CPU wide character to a LE Unicode character. */
 		ucs[o] = cpu_to_le16(wc);
 	}
+#ifdef HAVE_MBSINIT
 	/* Make sure we are back in the initial state. */
 	if (!mbsinit(&mbstate)) {
 		Dprintf("%s(): Eeek. mbstate not in initial state!\n",
@@ -498,6 +528,7 @@
 		errno = EILSEQ;
 		goto err_out;
 	}
+#endif
 	/* Now write the NULL character. */
 	ucs[o] = cpu_to_le16(L'\0');
 	if (*outs != ucs)
diff -ru ntfsprogs-1.8.0/ntfsprogs/ntfsundelete.c ntfsprogs-1.8.0.patch/ntfsprogs/ntfsundelete.c
--- ntfsprogs-1.8.0/ntfsprogs/ntfsundelete.c	Mon Nov  3 11:50:46 2003
+++ ntfsprogs-1.8.0.patch/ntfsprogs/ntfsundelete.c	Sun Jan  4 21:21:55 2004
@@ -23,7 +23,9 @@
 
 #include "config.h"
 
+#ifdef HAVE_FEATURES_H
 #include <features.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff -ru ntfsprogs-1.8.0/ntfsprogs/utils.c ntfsprogs-1.8.0.patch/ntfsprogs/utils.c
--- ntfsprogs-1.8.0/ntfsprogs/utils.c	Wed Nov 19 11:31:26 2003
+++ ntfsprogs-1.8.0.patch/ntfsprogs/utils.c	Sun Jan  4 20:54:26 2004
@@ -31,7 +31,9 @@
 #include <unistd.h>
 #include <string.h>
 #include <locale.h>
+#ifdef HAVE_LIBINTL_H
 #include <libintl.h>
+#endif
 #include <stdlib.h>
 #include <limits.h>
 
